﻿using System;
using System.Collections.Generic;
using System.Text;
using NHibernate;
using NHibernate.Expression;
using Castle.ActiveRecord;
using Castle.Components.Validator;
using System.ComponentModel;
using Castle.ActiveRecord.Queries;
namespace Mang24k99.Model.COMM
{
    [ActiveRecord(Table = "KT_COMM_TREEMENU_History")]
    public partial class MKtCommTreemenuHistory : ActiveRecordBase
    {
        /// <summary>
        /// Deleteses the specified where.
        /// </summary>
        /// <param name="where">The where.</param>
        public static void Deletes(string where)
        {
            DeleteAll(typeof(MKtCommTreemenuHistory), where);
        }
        /// <summary>
        /// Deleteses the specified pk values.
        /// </summary>
        /// <param name="pkValues">The pk values.</param>
        public static void Deletes(System.Collections.IEnumerable pkValues)
        {
            DeleteAll(typeof(MKtCommTreemenuHistory), pkValues);
        }

        /// <summary>
        /// Selects all.
        /// </summary>
        /// <returns></returns>
        public static IList<MKtCommTreemenuHistory> SelectAll()
        {
            return (IList<MKtCommTreemenuHistory>)FindAll(typeof(MKtCommTreemenuHistory));
        }
        /// <summary>
        /// Selects all.
        /// </summary>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        public static IList<MKtCommTreemenuHistory> SelectAll(params ICriterion[] criteria)
        {
            return (IList<MKtCommTreemenuHistory>)FindAll(typeof(MKtCommTreemenuHistory), criteria);
        }
        /// <summary>
        /// Selects all.
        /// </summary>
        /// <param name="orders">The orders.</param>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        public static IList<MKtCommTreemenuHistory> SelectAll(Order[] orders, params ICriterion[] criteria)
        {
            return (IList<MKtCommTreemenuHistory>)FindAll(typeof(MKtCommTreemenuHistory), orders, criteria);
        }
        /// <summary>
        /// Selects all.
        /// </summary>
        /// <param name="detachedCriteria">The detached criteria.</param>
        /// <param name="orders">The orders.</param>
        /// <returns></returns>
        public static IList<MKtCommTreemenuHistory> SelectAll(DetachedCriteria detachedCriteria, params Order[] orders)
        {
            return (IList<MKtCommTreemenuHistory>)FindAll(typeof(MKtCommTreemenuHistory), detachedCriteria, orders);
        }


        /// <summary>
        /// Selects all query.
        /// </summary>
        /// <param name="query">The query.</param>
        /// <returns></returns>
        [DataObjectMethod(DataObjectMethodType.Select)]
        public static IList<MKtCommTreemenuHistory> SelectAllQuery(SimpleQuery query)
        {
            return (IList<MKtCommTreemenuHistory>)ExecuteQuery(query);
        }


        /// <summary>
        /// Selects the by primary key.
        /// </summary>
        /// <param name="ID">The ID.</param>
        /// <returns></returns>
        public static MKtCommTreemenuHistory SelectByPrimaryKey(object ID)
        {
            return (MKtCommTreemenuHistory)FindByPrimaryKey(typeof(MKtCommTreemenuHistory), ID, false);
        }

        /// <summary>
        /// Selects the by primary key.
        /// </summary>
        /// <param name="ID">The ID.</param>
        /// <returns></returns>
        public static MKtCommTreemenuHistory SelectOne(DetachedCriteria detachedCriteria)
        {
            return (MKtCommTreemenuHistory)FindOne(typeof(MKtCommTreemenuHistory), detachedCriteria);
        }
        /// <summary>
        /// Selects the one.
        /// </summary>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        public static MKtCommTreemenuHistory SelectOne(params ICriterion[] criteria)
        {
            return (MKtCommTreemenuHistory)FindOne(typeof(MKtCommTreemenuHistory), criteria);
        }

        /// <summary>
        /// Selects the first.
        /// </summary>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        public static MKtCommTreemenuHistory SelectFirst(params ICriterion[] criteria)
        {
            return (MKtCommTreemenuHistory)FindFirst(typeof(MKtCommTreemenuHistory), criteria);
        }
        /// <summary>
        /// Selects the first.
        /// </summary>
        /// <param name="orders">The orders.</param>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        public static MKtCommTreemenuHistory SelectFirst(Order[] orders, params ICriterion[] criteria)
        {
            return (MKtCommTreemenuHistory)FindFirst(typeof(MKtCommTreemenuHistory), orders, criteria);
        }
        /// <summary>
        /// Selects the first.
        /// </summary>
        /// <param name="detachedCriteria">The detached criteria.</param>
        /// <param name="orders">The orders.</param>
        /// <returns></returns>
        public static MKtCommTreemenuHistory SelectFirst(DetachedCriteria detachedCriteria, Order[] orders)
        {
            return (MKtCommTreemenuHistory)FindFirst(typeof(MKtCommTreemenuHistory), detachedCriteria, orders);

        }

        /// <summary>
        /// Selects the ALL by property.
        /// </summary>
        /// <param name="property">The property.</param>
        /// <param name="value">The value.</param>
        /// <returns></returns>
        public static IList<MKtCommTreemenuHistory> SelectALLByProperty(string property, object value)
        {
            return (IList<MKtCommTreemenuHistory>)FindAllByProperty(typeof(MKtCommTreemenuHistory), property, value);
        }
        /// <summary>
        /// Selects the ALL by property.
        /// </summary>
        /// <param name="orderByColumn">The order by column.</param>
        /// <param name="property">The property.</param>
        /// <param name="value">The value.</param>
        /// <returns></returns>
        public static IList<MKtCommTreemenuHistory> SelectALLByProperty(string orderByColumn, string property, object value)
        {
            return (IList<MKtCommTreemenuHistory>)FindAllByProperty(typeof(MKtCommTreemenuHistory), orderByColumn, property, value);
        }

        /// <summary>
        /// Selects the ALL sliced.
        /// </summary>
        /// <param name="firstResult">The first result.</param>
        /// <param name="maxResult">The max result.</param>
        /// <param name="detachedCriteria">The detached criteria.</param>
        /// <returns></returns>
        public static IList<MKtCommTreemenuHistory> SelectALLSliced(int firstResult, int maxResult, DetachedCriteria detachedCriteria)
        {
            return (IList<MKtCommTreemenuHistory>)SlicedFindAll(typeof(MKtCommTreemenuHistory), firstResult, maxResult, detachedCriteria);
        }
        /// <summary>
        /// Selects the ALL sliced.
        /// </summary>
        /// <param name="firstResult">The first result.</param>
        /// <param name="maxResult">The max result.</param>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        public static IList<MKtCommTreemenuHistory> SelectALLSliced(int firstResult, int maxResult, params ICriterion[] criteria)
        {
            return (IList<MKtCommTreemenuHistory>)SlicedFindAll(typeof(MKtCommTreemenuHistory), firstResult, maxResult, criteria);
        }
        /// <summary>
        /// Selects the ALL sliced.
        /// </summary>
        /// <param name="firstResult">The first result.</param>
        /// <param name="maxResult">The max result.</param>
        /// <param name="orders">The orders.</param>
        /// <param name="detachedCriteria">The detached criteria.</param>
        /// <returns></returns>
        public static IList<MKtCommTreemenuHistory> SelectALLSliced(int firstResult, int maxResult, Order[] orders, DetachedCriteria detachedCriteria)
        {
            return (IList<MKtCommTreemenuHistory>)SlicedFindAll(typeof(MKtCommTreemenuHistory), firstResult, maxResult, orders, detachedCriteria);
        }
        /// <summary>
        /// Selects the ALL sliced.
        /// </summary>
        /// <param name="firstResult">The first result.</param>
        /// <param name="maxResult">The max result.</param>
        /// <param name="orders">The orders.</param>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        public static IList<MKtCommTreemenuHistory> SelectALLSliced(int firstResult, int maxResult, Order[] orders, params ICriterion[] criteria)
        {
            return (IList<MKtCommTreemenuHistory>)SlicedFindAll(typeof(MKtCommTreemenuHistory), firstResult, maxResult, orders, criteria);
        }

        /// <summary>
        /// Countses this instance.
        /// </summary>
        /// <returns></returns>
        public static int Counts()
        {
            return Count(typeof(MKtCommTreemenuHistory));
        }
        /// <summary>
        /// Countses the specified detached criteria.
        /// </summary>
        /// <param name="detachedCriteria">The detached criteria.</param>
        /// <returns></returns>
        public static int Counts(DetachedCriteria detachedCriteria)
        {
            return Count(typeof(MKtCommTreemenuHistory), detachedCriteria);
        }
        /// <summary>
        /// Countses the specified criteria.
        /// </summary>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        public static int Counts(params ICriterion[] criteria)
        {
            return Count(typeof(MKtCommTreemenuHistory), criteria);
        }


        /// <summary>
        /// Exists the specified id.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns></returns>
        public static bool Exist(object id)
        {
            return Exists(typeof(MKtCommTreemenuHistory), id);
        }
        /// <summary>
        /// Exists the specified id.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <param name="detachedCriteria">The detached criteria.</param>
        /// <returns></returns>
        public static bool Exist(DetachedCriteria detachedCriteria)
        {
            return Exists(typeof(MKtCommTreemenuHistory), detachedCriteria);
        }
        /// <summary>
        /// Exists the specified id.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <param name="criteria">The criteria.</param>
        /// <returns></returns>
        public static bool Exist(params ICriterion[] criteria)
        {
            return Exists(typeof(MKtCommTreemenuHistory), criteria);
        }
        protected override void OnDelete()
        {
            DeleteTime = DateTime.Now;
            base.OnDelete();
        }





        /// <summary>
        /// Gets or sets the ID.(ID)
        /// </summary>
        /// <value>The ID.</value>
        /// <remarks>
        /// ID
        /// </remarks>
        [PrimaryKey(PrimaryKeyType.Native, "ID"),
        ValidateIsUnique("ID必须唯一", RunWhen = RunWhen.Insert),
        ValidateRange(0, 2147483647, "ID的值要在0到2147483647之间"),
        ]
        public int? ID
        {
            get
            {
                return _ID;
            }
            set
            {
                _ID = value;
            }
        }


        /// <summary>
        /// Gets or sets the MenuNO.(MenuNO)
        /// </summary>
        /// <value>The MenuNO.</value>
        /// <remarks>
        /// MenuNO
        /// </remarks>
        [Property("MENU_NO"),
        ValidateRange(0, 2147483647, "MenuNO的值要在0到2147483647之间"),
        ]
        public int? MenuNO
        {
            get
            {
                return _MenuNO;
            }
            set
            {
                _MenuNO = value;
            }
        }


        /// <summary>
        /// Gets or sets the TreeNO.(编号)
        /// </summary>
        /// <value>The TreeNO.</value>
        /// <remarks>
        /// 编号
        /// </remarks>
        [Property("TREE_NO"),
        ValidateRange(0, 2147483647, "编号的值要在0到2147483647之间"),
        ]
        public int? TreeNO
        {
            get
            {
                return _TreeNO;
            }
            set
            {
                _TreeNO = value;
            }
        }


        /// <summary>
        /// Gets or sets the DisplayName.(菜单显示名)
        /// </summary>
        /// <value>The DisplayName.</value>
        /// <remarks>
        /// 菜单显示名
        /// </remarks>
        [Property("DISPLAY_NAME"),
        ValidateLength(1, 60, "菜单显示名长度必须在1到60之间"),
        ]
        public string DisplayName
        {
            get
            {
                return _DisplayName;
            }
            set
            {
                _DisplayName = value;
            }
        }


        /// <summary>
        /// Gets or sets the OprateType.(操作类型)
        /// </summary>
        /// <value>The OprateType.</value>
        /// <remarks>
        /// 操作类型
        /// </remarks>
        [Property("OPRATE_TYPE"),
        ValidateRange(0, 2147483647, "操作类型的值要在0到2147483647之间"),
        ]
        public int? OprateType
        {
            get
            {
                return _OprateType;
            }
            set
            {
                _OprateType = value;
            }
        }


        /// <summary>
        /// Gets or sets the LinkAddr.(链接地址)
        /// </summary>
        /// <value>The LinkAddr.</value>
        /// <remarks>
        /// 链接地址
        /// </remarks>
        [Property("LINK_ADDR"),
        ValidateLength(1, 120, "链接地址长度必须在1到120之间"),
        ]
        public string LinkAddr
        {
            get
            {
                return _LinkAddr;
            }
            set
            {
                _LinkAddr = value;
            }
        }


        /// <summary>
        /// Gets or sets the LinkRef.(链接参数)
        /// </summary>
        /// <value>The LinkRef.</value>
        /// <remarks>
        /// 链接参数
        /// </remarks>
        [Property("LINK_REF"),
        ValidateLength(1, 200, "链接参数长度必须在1到200之间"),
        ]
        public string LinkRef
        {
            get
            {
                return _LinkRef;
            }
            set
            {
                _LinkRef = value;
            }
        }


        /// <summary>
        /// Gets or sets the IsValidate.(是否有效)
        /// </summary>
        /// <value>The IsValidate.</value>
        /// <remarks>
        /// 是否有效
        /// </remarks>
        [Property("IS_VALIDATE"),
        ValidateRange(0, 2147483647, "是否有效的值要在0到2147483647之间"),
        ]
        public int? IsValidate
        {
            get
            {
                return _IsValidate;
            }
            set
            {
                _IsValidate = value;
            }
        }


        /// <summary>
        /// Gets or sets the InputTime.(输入时间)
        /// </summary>
        /// <value>The InputTime.</value>
        /// <remarks>
        /// 输入时间
        /// </remarks>
        [Property("INPUT_TIME"),
        ]
        public DateTime? InputTime
        {
            get
            {
                return _InputTime;
            }
            set
            {
                _InputTime = value;
            }
        }


        /// <summary>
        /// Gets or sets the ModifyTime.(修改时间)
        /// </summary>
        /// <value>The ModifyTime.</value>
        /// <remarks>
        /// 修改时间
        /// </remarks>
        [Property("MODIFY_TIME"),
        ]
        public DateTime? ModifyTime
        {
            get
            {
                return _ModifyTime;
            }
            set
            {
                _ModifyTime = value;
            }
        }


        /// <summary>
        /// Gets or sets the DeleteTime.(删除时间)
        /// </summary>
        /// <value>The DeleteTime.</value>
        /// <remarks>
        /// 删除时间
        /// </remarks>
        [Property("DELETE_TIME"),
        ]
        public DateTime? DeleteTime
        {
            get
            {
                return _DeleteTime;
            }
            set
            {
                _DeleteTime = value;
            }
        }



        private int? _ID;

        private int? _MenuNO;

        private int? _TreeNO;

        private string _DisplayName;

        private int? _OprateType;

        private string _LinkAddr;

        private string _LinkRef;

        private int? _IsValidate;

        private DateTime? _InputTime;

        private DateTime? _ModifyTime;

        private DateTime? _DeleteTime;


    }
}
